//
// Created by Tony on 2024/1/14.
//

#ifndef RUNTIME_TVM_H
#define RUNTIME_TVM_H

#include "../file_reader/FileUtil.h"
#include "interpreter/Interpreter.h"
#include "rt_code/ClassTable.h"
#include <memory>

namespace Runtime {

using std::shared_ptr;
using std::string;

class TVM {
    shared_ptr<RtCode::ClassTable> mClassTable;
    FileUtil fileUtil;

public:
    TVM();

    shared_ptr<RtCode::ClassTable> getClassTable() { return mClassTable; }

    shared_ptr<RtData::Frame> interpretStatement(const string& code);
    shared_ptr<RtData::Frame> interpretModule(const string& fileName);
    shared_ptr<RtData::Frame> interpretModule(const shared_ptr<SourceFile>& sourceFile);
    shared_ptr<RtData::Frame> interpretClass(const string& fileName);
    shared_ptr<RtData::Frame> interpretClass(const shared_ptr<SourceFile>& sourceFile);
};

} // namespace Runtime

#endif // RUNTIME_TVM_H
